﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CXedu.WebSite.Code;
using CXedu.Model;
using CXedu.Business;
using Ajeelee.Core.Utils;

namespace CXedu.WebSite.WebAdmin
{
    public partial class Category : AuthPageBase
    {
        protected IList<NewsClass> newsClassList = new List<NewsClass>();
        INewsClassBusiness newsClassBll = new NewsClassBusinessFactory().CreateNewsClassBusiness();

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                // 删除
                if (!string.IsNullOrEmpty(QueryParam("d")) && QueryParamInt32("d") > 0)
                {
                    newsClassBll.Delete(QueryParamInt32("d"));
                    newsClassBll.DeleteByPid(QueryParamInt32("d"));

                    Function.RemoveCacheObject("/cache/newsclassall/");
                }
                // 清空
                if (!string.IsNullOrEmpty(QueryParam("e")) && QueryParamInt32("e") > 0)
                {
                    newsClassBll.DeleteByPid(QueryParamInt32("d"));

                    Function.RemoveCacheObject("/cache/newsclassall/");
                }

                newsClassList = newsClassBll.GetAllNewsClass();
            }
            catch (System.Threading.ThreadAbortException ex) { }
            catch (Exception ex)
            {
                Function.WriteErrorLog(ex);
            }
        }
    }
}